<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<form action="/product/create" method="post" id="create">
    <input id="token" type="hidden" name="token"/>
</form>
<button type="button" onclick="submits()">提交</button>


</body>
<script>
    function getToken() {
        $.ajax( {
            url:"/product/savetoken",
            success:function (token) {
                $("#token").val(token);
            },
            async:false
        });
    }
    getToken();
    function submits() {

//        $.ajax( {
//            url:"/product/create",
//            success:function (token) {
//                $("#token").val(token);
//            },
//            async:false
//        });
        $("#create").submit();
    }
</script>
</html>
